<!--
 * @Author: lijing
 * @e-mail: 1413979079@qq.com
 * @LastEditors: lijing
 * @Date: 2020-01-09 14:39:34
 * @LastEditTime: 2020-04-21 23:52:46
 * @FilePath: \blog-pages\src\views\Websites.vue
 * @Description: 网站导航
 -->
<template>
  <div class="mh-100">
    <nav-bar></nav-bar>
    <b-container class="main bg-img">
      <div v-html="content"></div>
    </b-container>
    <Footer></Footer>
  </div>
</template>

<script>
import showdown from "showdown";
import showdownHighlight from "showdown-highlight";
// import NavBar from "@/components/NavBar";
import url from "@/request/url";
export default {
  name: "Websites",
  data() {
    return {
      content: ""
    };
  },
  components: {
    Footer: () => import("@/components/Footer"),
    NavBar: () => import("@/components/NavBar")
  },
  methods: {
    getContent() {
      this.$axios.get(url.comm.websites).then(resp => {
        let converter = new showdown.Converter({
          tables: true,
          // 使代码高亮显示
          extensions: [showdownHighlight],
          // 启用后可以为图片设置尺寸
          parseImgDimensions: true
        });
        // markdown 转 html
        this.content = converter.makeHtml(resp.data.content);
      });
    }
  },
  activated() {
    this.getContent();
  }
};
</script>

<style scoped>
</style>